<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
  <title>SysDict列表</title>
<header th:replace="header::html"></header>
</head>
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">SysDict</a>
        <a>
          <cite>SysDict列表</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>

<div class="x-body">
    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" id="contentSearchAdd">
            <input type="text" id="id" name="id"  placeholder="id" autocomplete="off" class="layui-input">
            <button class="layui-btn"  lay-submit=""   id="searchBtn" lay-filter="search"  data-type="reload" permission="sysDict:query"><i class="layui-icon">&#xe615;</i></button>
            <a class="layui-btn" onclick="x_admin_show('新增SysDict','/sysDicts/addOrEdit/?id=0')" permission="sysDict:add"><i class="layui-icon"></i>新增</a>
        </form>
    </div>

    <table class="layui-hide" id="table" lay-filter="member"></table>

    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-xs" lay-event="edit"  permission="sysDict:edit">编辑</a>
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"  permission="sysDict:del">删除</a>
    </script>
</div>

</body>
</html>
<script type="text/javascript">

 layui.use('table', function(){
    $ = layui.jquery;
    var table = layui.table,
        form=layui.form;
    table.render({
        elem: '#table'
        ,url: '/sysDicts/listPage' //数据接口
        ,page: true //开启分页
        ,response: {
            countName: 'count', //规定数据总数的字段名称，默认：count
            dataName: 'datas' //规定数据列表的字段名称，默认：data
        }
        , cols: [
             [ //表头
               	{"type" : 'checkbox', "fixed" : 'left'},
				{field : 'id', title : ''},
				{field : 'dictKey', title : ''},
				{field : 'dictValue', title : ''},
				{field : 'dictType', title : ''},
				{field : 'remark', title : ''},
				{field : 'status', title : ''},

               {fixed: 'right', title: '操作', toolbar: '#barDemo', width: 150}
            ]
        ]
        ,id: 'testReload'

    });

    /* var $ = layui.$, active = {
             reload: function(){
             //执行重载
             table.reload('testReload', {
                 page: {
                     curr: 1 //重新从第 1 页开始
                 }
                 ,where: {
                     key: {
                         id:  $("#id").val()
                     }
                 }
             });
         }
     };
    //搜索
     $('#searchBtn').on('click', function(){
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
    });

     //监听工具条
    table.on('tool(member)', function(obj){
        var data = obj.data;
        if(obj.event === 'del'){
            layer.confirm('真的删除行么', function(index){
                $.ajax({
                    url:"/sysDicts/delete",
                    type:"GET",
                    data:{id:data.id},
                    dataType:'json',
                    success:function(result){
                        if(result.code == 200){
                            layer.alert("删除成功", {icon: 1},function (index1) {
                                layer.close(index1);
                                x_admin_father_reload();
                            });
                        }else{
                            layer.alert(result.msg);
                        }

                    },
                });
            });
        } else if(obj.event === 'edit'){
            var id = data.id;//当前行的id
            x_admin_show('编辑信息','/sysDicts/addOrEdit/?id='+id);
        }
    })*/

});

</script>
